package com.itheima.date.jdk8date;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入入职日期:");
        String s = sc.next();
        s += " 00:00:00";

        //将此字符串解析为LocalDateTime对象
        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH:mm:ss");
        LocalDateTime start = LocalDateTime.parse(s, pattern);

        //当前日期
        LocalDateTime now = LocalDateTime.now();

        Duration duration = Duration.between(start, now);
        long days = duration.toDays();
        System.out.println("小张已经入职" + days + "天啦");
    }
}
